#include <iostream>
using namespace std;

string IsPrime(int n) {
  if (n > 2 && n % 2 == 0) {
    return "No";
  }
  for (int i = 3; i * i <= n; i += 2) {
    if (n % i == 0) {
      return "No";
    }
  }
  return n > 1 ? "Yes" : "No";
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int T;
  for (cin >> T; T; T--) {
    int n;

    cin >> n;
    cout << IsPrime(n) << "\n";
  }
  return 0;
}